package com.sba.core.service;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * 基本service接口.
 * 
 * @author feiliming
 *
 */
public interface BaseService<T> {

	T saveOrUpdate(T entity) throws RuntimeException;
	
	T findById(Long id);
	
	boolean exists(Long id);
	
	void delete(Long id);

	void delete(T entity);
	
	void delete(Iterable<? extends T> entities);
	
	List<T> findAll();

	List<T> findAll(Sort sort);

	List<T> findAll(Iterable<Long> ids);
	
	Page<T> findAll(Pageable pageable);

}
